SgNode
This class represents the base class for all IR nodes within Sage III.
Synopsis
Declared in <src/frontend/SageIII/Cxx_Grammar.h>
class SgNode;
Friends
Name |
Description |
|
Casts pointer from base class to derived class (for const pointers) |
|
Casts pointer from base class to derived class |
Non-Member Functions
Name |
Description |
This does all post‐processing fixup and translation of the Sage III AST. |
|
Fixups transformations that have added template instantiations or caused template instantiations to be output so that there is a proper prototype declaration before the template instantation is called. |
|
Change all members in a program to be public. There should really be a smarter procedure for this that only changes members used by inlined code. |
|
Checks whether appropriate nodes of an AST are marked as compiler‐generated. |
|
Checks whether appropriate nodes of an AST are marked as front‐end specific. |
|
Checks whether the physical source position information is consistant in the Sg_File_Info object |
|
Check for consistancy of isTransformation flags for nodes marked as a transformation. |
|
Combined procedure for cleaning up code after inlining. Does not do variable renaming or block flattening, however. |
|
Detect nodes marked as transformations (should not be present coming out of the frontend translation). |
|
Traverse the AST |
|
Find all variables referenced in a region |
|
Workaround for ROSE bug. Should be used whenever expressions in a program are modified. |
|
Fixup all SgDeclarationStatement to have a consistant scope (between the defining and all non‐defining declarations). |
|
Fixup all SgDeclarationStatement references to defining and non‐defining declarations. |
|
Fixup global and local symbol tables. |
|
Fixup C++ symbol tables to use aliasing symbols for using declarations. |
|
Fixup definingDeclaration and firstNondefiningDeclaration pointers in SgDeclarationStatement. |
|
Checks and fixes up inconsistanties in the settings of Sg_File_Info flags (e.g. isTransformation flag) in the Sg_File_Info object |
|
Fixup Fortran array vs. function references. |
|
Fixup Fortran Use declarations. |
|
Fixup specific pointers in the AST that we would like to not have be NULL. |
|
Fixup known macros that reference themselves and cause recursive macro expansion in the generated (unparsed) code. |
|
Fixup the storage access of all compiler‐generated forward declarations (non‐defining declarations) to match that of the defining declaration. |
|
Fixups template specializations generated by ROSE from template instantiations. |
|
Flatten nested blocks of code in a program. This code requires that variable names in the region being processed are already distinct, and it may extend variable lifetimes to the end of the outer block of code. |
|
Get the statement of an expression. Somewhat smarter than the standard version of this routine, but needs to be merged. |
|
Initialize explicit scopes (support function should not be called). |
|
Initialize explicit scopes (located only at specific IR nodes). |
|
Insert Fortran "CONTAINS" statement. |
|
Internal routine to check whether a given variable declaration is a member variable. |
|
Casts pointer from base class to derived class (for const pointers) |
|
Casts pointer from base class to derived class |
|
Casts pointer from base class to derived class (for const pointers) |
|
Casts pointer from base class to derived class |
|
Casts pointer from base class to derived class |
|
Casts pointer from base class to derived class (for const pointers) |
|
Mark an AST subtree as compiler generated (used for instatiated templates generated by ROSE as specializations). |
|
Mark an backend specific functions as compiler generated. |
|
Mark an AST subtree as compiler generated and to be output in the source file (code generation phase). |
|
Mark relavant expressions as l‐values explicitly. |
|
Mark any template instatiations that are overloaded (we can't output these since g++ can't resolve them). |
|
Mark an AST subtree to be unparsed using an alternative file (for multi‐file unparsing). |
|
Fixups template instantiations generated by ROSE from template declarations. |
|
Fixups transformations (which are often marked at a high level and need to be marked properly through their subtree). |
|
Move variables declared in a for statement to just outside that statement. |
|
Postprocessing that is not likely to be handled in the legacy frontend/Sage III translation. |
|
Fixup template instantiations to unmark them for output followingsemantics of gnu template options |
|
Propagate hidden list information for variables, types, and class elaboration. |
|
Change all variable and label references to point to new symbols, created to point to the matching declaration found in the program. This needs to be moved into somewhere in FixSgTree. |
|
Remove all null statements (those with only an integer constant or a null expression) |
|
Remove unused variables in a scope |
|
Rename all labels in a block of code. |
|
Rename all variables in a block of code, and ensure that all variable references point to the correct declarations. |
|
Replace a child of a node. |
|
This function acts in two different ways |
|
Interface function to reset parent pointers. |
|
This traversal calles ResetParentPointersInMemoryPool Memory Pool traversal. |
|
This is a top level function not called recursively. |
|
Sets names of template classes (calls custom traversal). |
|
In code with declarations such as "int foo = bar", where foo and bar are not modified, replace "foo" with "bar" and remove the declaration |
|
Do a simple form of finite differencing on all functions contained within root (which should be a project, file, or function definition). |
|
This is a top level function not called recursively. |
|
Create a deep‐copy of an SgNode |
|
Returns 'true' if this node is contained in a C99‐only project. |
|
Reset source position as transformation for the current node only |
|
|
Reset source position as transformation recursively |
**** The function Result querySubTree ( SgNode * subTree, _Result (__x)(SgNode_,_Arg), Arg x_arg, AstQueryNamespace::QueryDepth defineQueryType =AstQueryNamespace::AllNodes ) will query the subtree of the IR node in the first argument for nodessatisfying the criteria specified in and returned by the function pointer inthe second argument.** |
|
** The function Result querySubTree ( SgNode * subTree, _Result (__x)(SgNode_), AstQueryNamespace::QueryDepth defineQueryType =AstQueryNamespace::AllNodes )* will query the subtree of the IR node in the first argument for nodessatisfying the criteria specified in and returned by the function pointer inthe second argument.** |
|
**** The function std::list<ListElement> querySubTree<ListElement>(SgNode* node,Predicate& _pred) will query the subtree of the IR node in the first argumentfor nodes satisfying the criteria specified in and returned by the predicatein the second argument.** |
|
Collect non‐local variables that are read and written within the given ast. This is a wrapper of the ComputeAstSideEffects function to provide a more convenient user interface. Returns true if the returned variables are guaranteed to be complete; returns false otherwise. |
|
Returns the collection of memory references modified, read, and invoked (as function calls) as potential side effects of running the given ast, inside the given scope. |
|
Extracts the '#if' directive structure from a project. |
|
Checks if the functionDeclaration (node) matches functionType |
|
This is the external interface of constant folding: |
|
**** |
|
**** |
|
**** |
|
**** |
|
** The function NodeQuerySynthesizedAttributeType queryMemoryPool ( SgNode * subTree, Result (*x)(SgNode*,_Arg), Arg x_arg, VariantVector ){ will on every node of the memory pool which has a corresponding variant inVariantVector performa the action specified by the second argument and returna NodeQuerySynthesizedAttributeType.* |
|
** The function Result queryMemoryPool ( SgNode * subTree, SgNode, TypeOfQueryTypeTwoParameters, VariantVector* ){ will on every node of the memory pool which has a corresponding variant inVariantVector performa the predefined action specified by the second argumentand return a NodeQuerySynthesizedAttributeType.** |
|
** The function Result queryMemoryPool ( SgNode * subTree, _Result (__x)(SgNode_), VariantVector* ){ will on every node of the memory pool which has a corresponding variant inVariantVector performa the action specified by the second argument and returna NodeQuerySynthesizedAttributeType.** |
|
**** |
|
**** |
|
**** |
|
The function querySubTree (SgNode * subTree, VariantVector targetVariantVector, AstQueryNamespace::QueryDepth defineQueryType =AstQueryNamespace::AllNodes); reutnrs a list of all SgNodes us the ASTsub‐tree of the variable 'subTree' conforming to the variants inVariantVector.***** |
|
**** |
|
**** |
|
**** |
|
**** |
|
**** |
|
**** |
|
**** |
|
A helper function to generate implicit or explicit task for either omp parallel or omp task |
|
Find an enclosing parallel region or function definition's body |
|
Replace references to oldVar within root with references to newVar, return the number of references replaced. |
|
Replace variable references within root based on a map from old symbols to new symbols |
|
Replace all variable references in a set by pointers to the variable |
|
Translate omp atomic |
|
Translate omp barrier |
|
Translate omp critical |
|
Translate omp flush |
|
Translate omp for or omp do loops |
|
Translate omp master |
|
Translate omp metadirective |
|
Translate the ordered directive (not the ordered clause) |
|
Translate omp parallel |
|
Translate omp sections |
|
Translate omp simd |
|
Translate omp single |
|
Translate "omp target" |
|
Translate "omp target data" |
|
Translate omp for or omp do loops affected by the "omp target" directive, using naive 1‐to‐1 mapping Liao 1/28/2013 |
|
Translate omp for or omp do loops affected by the "omp target" directive, using a round robin‐scheduler Liao 7/10/2014 |
|
Translate omp parallel under "omp target" |
|
Translate omp task |
|
Translate omp taskwait |
|
Translate omp threadprivate |
|
Translate omp tile |
|
Translate omp unroll |
|
Helper Function to process Left Hand Side of an Expression |
|
Helper Function to process Right Hand Side of an Expression |
|
Error checking the inserted snippet AST. |
|
Sharing IR nodes requires that the file id be added to the fileIDsToUnparse held in the Sg_File_Info object. |
|
Add a string to be unparsed to support code generation for back‐end specific tools or compilers. |
|
Find all SgPntrArrRefExp under astNode, then add SgVarRefExp (if any) of SgPntrArrRefExp's dim_info into NodeList_t |
|
Compute the intersection set for two ASTs. |
|
Fix up ifs, loops, while, switch, Catch, OmpBodyStatement, etc. to have blocks as body components. It also adds an empty else body to if statements that don't have them. |
|
Clear those variable symbols with unknown type (together with initialized names) which are also not referenced by any variable references or declarations under root. If root is NULL, all symbols with unknown type will be deleted. |
|
This collects the SgLocatedNodes that are marked as modified (a flag automatically set by all set_* generated functions) (useful in debugging). |
|
This collects the statements that are marked as modified (a flag automatically set by all set_* generated functions) (useful in debugging). |
|
This collects the statements that are marked as transformed (useful in debugging). |
|
Traversal to set the global map of names to node and node to names.collisions to support generateUniqueNameForUseAsIdentifier() function. |
|
Constant folding an AST subtree rooted at 'r' (replacing its children with their constant values, if applicable). Please be advised that constant folding on floating point computation may decrease the accuracy of floating point computations! It is a wrapper function for ConstantFolding::constantFoldingOptimization(). Note that only r's children are replaced with their corresponding constant values, not the input SgNode r itself. You have to call this upon an expression's parent node if you want to fold the expression. |
|
|
XXX This function operates on the new file used to support outlined function definitions. We use a copy of the file where the code will be outlined FROM, so that if there are references to declarations in the outlined code we can support the outpiled code with those references. This approach has the added advantage of also supporting the same include file tree as the original file where the outlined code is being taken from. |
Variable references can be introduced by SgVarRef, SgPntrArrRefExp, SgInitializedName, SgMemberFunctionRef etc. For Dot and Arrow Expressions, their lhs is used to obtain SgInitializedName (coarse grain) by default. Otherwise, fine‐grain rhs is used. |
|
Deep copy an arbitrary subtree |
|
Deep delete a sub AST tree. It uses postorder traversal to delete each child node. Users must take care of any dangling pointers, symbols or types that result. This is identical to deleteAST() |
|
|
Special purpose function for deleting AST expression tress containing valid original expression trees in constant folded expressions (for internal use only). |
Dump information about a SgNode for debugging |
|
Topdown traverse a subtree from root to find the first declaration given its name, scope (optional, can be NULL), and defining or nondefining flag. |
|
Topdown traverse a subtree from root to find the first function declaration matching the given name, scope (optional, can be NULL), and defining or nondefining flag. This is an instantiation of findDeclarationStatement<T>. |
|
top‐down traversal from current node to find the main() function declaration |
|
Find unused labels which are not targets of any goto statements |
|
Mostly used internally when some AST pieces are built without knowing their target scope/parent, especially during bottom‐up construction of AST. The associated symbols, parent and scope pointers cannot be set on construction then. A set of utility functions are provided to patch up scope, parent, symbol for them when the target scope/parent become know. |
|
Generate unique name from C and C++ constructs. The name may contain space. |
|
Get the enclosing type of this associated node, not used other than in ./src/backend/unparser/nameQualificationSupport.C |
|
Get the right bool type according to C or C++ language input |
|
Get the closest class declaration enclosing the specified AST node, |
|
Get the closest class definition enclosing the specified AST node, |
|
Get the enclosing SgExprListExp (used as part of function argument index evaluation in subexpressions). |
|
get the SgFile node from current node |
|
Find the enclosing function declaration, including its derived instances like isSgProcedureHeaderStatement, isSgProgramHeaderStatement, and isSgMemberFunctionDeclaration. |
|
Get the closest module statement enclosing the specified AST node, |
|
Find a node by type using upward traversal. |
|
Find the function definition |
|
Get the enclosing scope from a node n |
|
Find enclosing source file node |
|
Find the closest enclosing statement, including the given node |
|
Traverse back through a node's parents to find the enclosing global scope |
|
Return the loop index variable for a for loop |
|
Get the closest scope from astNode. Return astNode if it is already a scope. |
|
Get the enclosing TemplateDeclaration statement |
|
Generate a useful name to describe the SgNode |
|
check if node1 is a strict ancestor of node 2. (a node is not considered its own ancestor) |
|
Check if a SgNode _s is an assignment statement (any of =,+=,‐=,&=,/=, ˆ=, etc) |
|
Check if a for‐loop has a canonical form, return loop index, bounds, step, and body if requested |
|
Check if a SgNode is a main() function declaration |
|
Check if a node is SgOmp*Statement |
|
Check if a SgNode is a declaration for a structure |
|
Check if a SgNode is a declaration for a union |
|
Convert all code within root matching the patern of (&left)‐>right, and translate them into left.right. Return the number of matches of the pattern. Be default, only transformation generated nodes will be normalized. |
|
Output the local symbol tables. |
|
Pretty print AST horizontally, output to std output. |
|
Pretty print AST horizontally, output to a specified file, a simpiler interface than printAST2TextFile() |
|
Pretty print AST horizontally, output to a specified text file. If printType is set to false, don't print out type info. |
|
Pretty print AST horizontally, output to a specified text file. If printType is set to false, don't print out types info. |
|
Query a subtree to get all nodes of a given type, with an appropriate downcast. |
|
Recursively print current and parent nodes. used within gdb to probe the context of a node. |
|
Set original expression trees to NULL for SgValueExp or SgCastExp expressions, so you can change the value and have it unparsed correctly. |
|
Remove consecutive labels |
|
Remove jumps whose label is immediately after the jump. Used to clean up inlined code fragments. |
|
Remove labeled goto statements |
|
Remove labels which are not targets of any goto statements: its child statement is also removed by default. |
|
Replace an anchor node with a specified pattern subtree with optional SgVariantExpression. All SgVariantExpression in the pattern will be replaced with copies of the anchor node. |
|
Save AST into a pdf file. Start from a node to find its enclosing file node. The entire file's AST will be saved into a pdf. |
|
we have two serialize() functions, one for a single node, the other for a list of pointers |
|
Set the lower bound of a loop header for (i=lb; ...) |
|
Set the stride(step) of a loop 's incremental expression, regardless the expression types (i+=s; i= i+s, etc) |
|
Set the upper bound of a loop header,regardless the condition expression type. for (i=lb; i op up, ...) |
|
Set current node's source position as transformation generated |
|
Set current node's source position as NULL |
|
Set the source code positon for the current (input) node. |
|
DQ (5/1/2012): New function with improved name. |
|
Set the source code positon for the subtree (including the root). |
|
Recursively set source position info(Sg_File_Info) as transformation generated |
|
Diagnostic function for tracing back through the parent list to understand at runtime where in the AST a failure happened. |
|
returns location (consisting of filename, line, column) Abbreviates fileName if too long, max file name length can be set |
|
this function should only be called for a node in the subtree of a SgFunctionDefinition node. For a given 'node' it determines the correspondnig functionDefinition node when searching upwards in the AST for such a SgFunctionDefinition node. It is useful as a simple lookup function from inside the AST subtree of a SgFunctionDefinition. Returns 0 if no SgFunctionDefinition is found (e.g. global scope). |
|
computes for a given node the index number of it from the parent. e.g. node1(node2,node3,node4) : node4 has index 2 (starting at 0) For the root node of an AST (e.g. SgProject) this function returns ‐1. |
|
determines all VarRefExp in the subtree of 'node'. The order in the vector corresponds to the traversal order on the AST. |
|
returns the function declaration statement found for a given function symbol. |
|
returns the declaration statement found for a given variable symbol. |
|
returns the root node representing the AST of the condition of If, While, DoWhile, For, CondOperator, switch. |
|
returns the child of SgExpressionRoot (which is guaranteed to be unique and to exist) |
|
returns the child of SgExprStatement (which is guaranteed to be unique and to exist) |
|
returns the root node representing the AST of the false branch of If, CondOperator. |
|
returns the first child of an arbitrary AST node (throws exception if numChildren==0) |
|
returns the first Statement of SgBasicBlock (throws exception if numChildren==0) |
|
returns the incr/derc‐expr of For. |
|
returns the initializer‐list of For. |
|
return a function‐call's argument list |
|
return a function‐definition's list of formal paramters |
|
returns function name of SgFunctionDefinition, SgFunctionDeclaration, SgFunctionCall. |
|
return a function‐definition's return type |
|
returns the label name of a SgLabelStatement without trailing ":" |
|
returns the last Statement of SgBasicBlock (throws exception if numChildren==0) |
|
return lhs of a binary node (if it is not a binary node it throws an exception) |
|
returns the root node representing the AST of the loop body of While, DoWhile, For. |
|
returns the parent of a node. Essentially a wrapper function of the ROSE get_parent() function, but throws an exception if no parent exists. For SgProject node no exception is thrown if no parent exists because it is the root node of a ROSE AST. |
|
return rhs of a binary node (if it is not a binary node it throws an exception) |
|
returns the root node representing the AST of the true branch of If, CondOperator. |
|
returns the child of a SgUnaryExp (which is guaranteed to be unique and to exist) |
|
checks whether the expression 'node' represents an assignment to an array's element considers all assignment operators and arrays of any size |
|
checks whether the node 'node' is the root node of the AST by using the get_parent function. |
|
is true if 'node' is the root node of the AST representing the condition of If, While, DoWhile, For, switch, CondExp. |
|
is true if 'node' is the root node of the AST representing the condition of If, While, DoWhile, For, switch. |
|
is true if 'node' is the root node of the AST representing If, While, DoWhile, For, switch. |
|
is true if 'node' is the root node of the AST representing If, While, DoWhile, For, switch, CondExp. |
|
determines whether a node is the root node of an AST representing the inc‐expr in a SgForStatement. This function is helpful to deal with this special case in the ROSE AST where an expression does not have a root node which can be easily determined to be a root node of an expression (i.e. here it can be any binary or unary node in constrast to all other expressions in the ROSE AST which are either a SgExprStatement or have a SgExpressionRoot node. |
|
Determines whether a provided function declaration is a forward declaration |
|
checks whether a SgVariableSymbol is representing a function parameter (this does not apply for forward declarations) |
|
checks whether 'elem' is the last child (in traversal order) of node 'parent'. |
|
is true if 'node' is the root node of the AST representing the condition of a Loop construct (While, DoWhile, For). |
|
is true if 'node' is the root node of the AST representing a Loop construct (While, DoWhile, For). |
|
returns true for Expr‐‐ and Expr‐‐, otherwise false; |
|
returns true for ‐‐Expr and ++Expr, otherwise false. |
|
checks whether a SgVariableSymbol is representing a variable in |
|
returns line, column, and unparsed node in one string. |
|
returns a std::pair of line and column number. If no file info exists at this node it returns (‐1,‐1). |
|
returns location (consisting of filename, line, column) and source code of unparsed node in one string. Abbreviates fileName and unparsed source if too long (defaults are 30,20) |
|
returns location (consisting of filename, line, column) |
|
returns a set of SgNode where each node is a break node, but properly excludes all nested loops. |
|
matches C and C++ function calls (also ctor and dtor) |
|
returns a string representing the node (excluding the subtree) |
|
returns the number of children as int (intentionally not as t_size) ensures that the number of children fits into an int, otherwise throws exception. |
|
replaces the ast with root 'node' with the string 's'. The string is attached to the AST and the unparser uses string s instead of unparsing this substree. This function can be used to generate C++ extensions. |
|
computes for a given node at which scope nesting level this node is in its AST |
|
computes for a given node at which scope nesting level this node is in its AST |
|
returns filename+line+column information of AST fragment in format "filename:line:column". Used for generating readable output |
|
returns filename as stored in AST node. Used for generating readable output. |
|
returns filename followed by line:column in one string. Used for generating readable output. |
|
returns filename followed by line, separator, and column in one string. Used for generating readable output. |
|
collects all case labels from the switch it started in (excludes nested switch stmts). This function also works for Duff's device code where 'case' labels can be inside nested loop/if constructs. |
|
returns the default stmt if it exists. Otherwise return 0 and can be used to test whether a default stmt exists in a given switch stmt. This function also works for Duff's device code. code where 'default' labels can be inside nested loop/if constructs. |
|
Creates a long unique variable name for a given node of type SgVariableDeclaration or SgVarRefExp |
|
returns the string representing the condition (removes trailing ';') |
|
Assign Ids and save current File Info. |
|
The first CFG node for a construct (before the construct starts to execute) |
|
The last CFG node for a construct (after the entire construct has finished executing). This node may not actually be reached if, for example, a goto causes a loop to be exited in the middle |
|
Dump the filtered dot graph of a virtual control flow graph starting from SgNode (start) |
|
Dump the full dot graph of a virtual control flow graph starting from SgNode (start) |
|
Dump a CFG with only interesting nodes for a SgNode |
|
Returns CFG node for just before start |
|
* CALL‐BACK FUNCTIONS FOR cfgRWTransaction::transform() ** |
|
/ SgExpression that is that/ assignment (effectively a type cast) or NULL otherwise |
|
finds an ancestor node with a given type |
|
asserts that n has type SageNode |
|
unchecked down cast from SgNode to SageNode |
|
tests pattern for an assert |
|
|
tests pattern SgExprStatement(SgAssignOp(VarRefExp,FunctionCallExp)) and returns pointer to FunctionCallExp otherwise 0. |
tests pattern SgExprStatement(FunctionCallExp) and returns pointer to FunctionCallExp, otherwise 0. |
|
tests several patterns and returns pointer to FunctionCallExp inside that matched pattern, otherwise 0. |
|
|
tests pattern for function call in variable declaration and returns pointer to FunctionCallExp otherwise 0. |
tests pattern SgReturnStmt(FunctionCallExp) and returns pointer to FunctionCallExp, otherwise 0. |
|
tests pattern SgFunctionCall(...) where the name of the function is fprintf with 3 params |
|
tests pattern SgFunctionCall(...) where the name of the function is printf with 2 params |
|
tests pattern SgFunctionCall(...) where the name of the function is scanf with 2 params |
|
|
checks variable declaration with function call, returns variable declaration. Otherwise 0. e.g. int x=f(); |
|
checks variable declaration with function call, returns both in a pair, or a with (0,0). |
Get the function definition containing a given node |
|
Do partial redundancy elimination on all functions within the scope n. |
Derived Classes
Name |
Description |
This class represents the notion of an expression or statement which |
|
This class represents the base class of a numbr of IR nodes that don't otherwise fit |
|
This class represents the concept of a name within the compiler. |
|
This class represents the base class for all types. |
Description
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
This class is used as a base class for all IR nodes in Sage III. ‐ Note: AST attributes should not be used for the following IR nodes: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Internal: Need to remove unused error() and variant() functions. ‐ Todo: The "AstAttributeMechanism attribute;" field should be fixed: ‐ The attribute within this class is not added using ROSETTA and is one of the last (if not the last) variable to NOT be added to the IR nodes using ROSETTA. Because it is not added using ROSETTA, it is a special case (and we hate special cases) in the file I/O (by Jochen) and perhaps elsewhere. This variable should be added using ROSETTA! ‐ Access functions need to be built for the "AstAttributeMechanism attribute;" field and it needs to be moved to be a private data member. ‐ It should be moved to only those IR nodes were it makes sense, e.g. excluded from: ‐# SgName ‐# SgModifier (and all derived modifier IR nodes) ‐# SgUnparse_Info ‐# SgSymbolTable ‐ Todo: Consider eliminating the set_freepointer() function since only the internal memory allocation mechanisms should use it (and they are forced to access the data member directly since they traverse the memory pools directly and member function can onl be called on allocated object initialized vi the new operator (with a proper constructor call, so that the this pointer is set properly)). Perhaps we don't need access functions for this data member at all. ‐ See also: Example of using a SgNode object ‐ See also: Enforced AST Properties
Data members
#### SgNode::attribute This is the new attribute mechanism. This is part of a new attribute mechanism. It is difference from the one originally used by Sage II.
#### SgNode::p_parent This is the pointer to the parent IR node in the AST. This is the pointer to the parent IR node. It is a valid pointer on all nodes that are traversed (SgExpressions, SgStatements, SgInitializedName, etc.) However it is not set on SgTypes and SgSymbols,both of which are shared internally. This pointer is mostly set in post processing of the Sage III AST, until this point it is not reliable.
#### SgNode::p_isVisited This the visit flag previously used by the AST traversals. This the visit flag previously used by the AST traversals. It is no longer used in the AST traversals, though the traversals can be set at compile‐time to alternatively use this visit flag. The visit flag is part of an older design of the AST traversal, it was problematic by design, because it had to be reset after each traversal. It also placed requirements on any newly added IR nodes within the AST (they had to be set so just right so that they could be properly reset). The AST traversals are greatly simplified as a result of no longer requiring this visit flag. This variable will be removed in the future. ‐ Deprecated: Old traversal supporting mechanism (will be removed).
#### SgNode::p_freepointer This is the pointer to the chain of previously freed objects. ‐ Internal: This is part of the support for memory pools within ROSE. The freepointer is only manipulated by the delete operator which constructs a chain of previously freed objects embedded within the memory pools. The chain of objects link by the freepointer variables are traversed by the new operator to allocate (reuse) previously deleted objects. The new operator does not reset the freepointers since once allocated the freepointer is ignored.
#### SgNode::p_isModified Records if IR node has been modified (data members reset). This is part of an internal mechanism that records if IR nodes have been modified, either by a transformation or a access function to set a value on the IR node. All access functions that set IR node data members are automatically generated (except the ones for this data member) and include code to set this boolean flag to true. This is also part of the support for copy based code generation where source file is copied except where the AST was modified an for these subtrees new code is generated from the AST. ‐ Internal: true if IR node has been modified, else false.
#### SgNode::p_globalFunctionTypeTable Pointer to symbol table specific to function types. ‐ Internal: Always a valid pointer.
#### SgNode::p_globalMangledNameMap Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization. ‐ Internal: This cache should be cleared automatically where required.
#### SgNode::p_shortMangledNameCache STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates. ‐ Internal: This cache should be cleared before regenerating mangled names.
Member functions
#### SgNode::copy(const SgCopyHelp & help ) const This function clones the current IR node object recursively or not, depending on the argument This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value. ‐ Param help: ‐ If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members. ‐ Return: a pointer to the new clone. ‐ Internal: It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal. ‐ Exception: none No exceptions are thrown by this function.
#### SgNode::SgNode() This is the constructor This constructor builds a SgNode, always used as a base class. All Sage III IR nodes are derived from this class. ‐ See also: Example:create an SgNode object
#### SgNode::~SgNode() This is the destructor. There is nothing to delete in this object.
#### SgNode::sage_class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Deprecated: Use class_name() which returns a C++ string object. ‐ Return: a char* pointer to a C style string.
#### string SgNode::class_name() const generates string representing the class name: (e.g. for SgNode returns "SgNode"). This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: a C++ string object.
#### SgNode::variant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::getVariant() const Older version function returns enum value "NODE" This function is an older version of the variant function. This function is useful for debugging and error reporting. It returns the name of the IR node. ‐ Return: an int value. ‐ Deprecated: Use variantT() instead. Older enum values have inconsistant names and are being removed.
#### SgNode::variantT() const returns enum value "V_SgNode" This function is useful for debugging and error reporting. It returns the name of the IR node. Once the variant() function is removed this function will be deprecated and replaced by a new function named "variant()". The new "variant()" function will return the new enum type (with consistant naming convention in place). The name of the enum type might be changed to make it more clear. ‐ Return: an enum value (type: VariantT).
#### SgNode::get_isModified() const FOR INTERNAL USE All nodes in the AST contain a isModified flag. This flag can be set but this is typically an internal function used to track the updates to AST. ‐ Return: Returns bool; true if IR node has been modified.
#### SgNode::set_isModified(bool isModified) Acess function for isModified flag. This flag records if the current IR node has been modified. It is set to false after and ROSE front‐end processing.
#### SgNode::get_isVisited() const DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed. ‐ Return: Returns bool; true if previously visited within current AST traversal.
#### SgNode::set_isVisited(bool isVisited) DOCS IN SgNode.docs: Access function for p_isVisited flag used previously by the AST traversals. ‐ Deprecated: This function is not used and will be removed.
#### SgNode::isSgNode (SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::isSgNode (const SgNode *s) Cast function (from derived class to SgNode pointer). This functions returns a SgNode pointer for any input of a pointer to an object derived from a SgNode. ‐ Return: Returns valid pointer to SgNode if input is derived from a SgNode.
#### SgNode::set_parent (SgNode *parent) Sets parent node for any IR node. The parent node in the AST can be set but this is typically an internal function used to build the AST. ‐ Param parent: ‐ Pointer to parent node to store within the current IR node. ‐ Return: returns void.
#### SgNode::get_parent() const Access function for parent node in AST. The parent node in the AST can be accessed, in general only the project node, symbols and types should be NULL. Since parent nodes are set within post processing (and using the ROSE AST traveral mechanism) the parents are guarenteed to match the traversal, and no other concept of what could be a parent within the AST (e.g a parent concept based on scope). Because the traversal is based on the source code layout, what is a parent is similarly based on the source code layout and not any concept of scope. Note that the scope of relavant IR nodes is stored explicitly in the AST, precisely because it is not always related to the layout of the source code (and thus not related to the concept of parent in the AST). ‐ Return: Returns pointer to SgNode
#### SgNode::unparseToString( SgUnparse_Info* info ) This function unparses the AST node (source code only, excluding comments and white space) ‐ Param info: is optional (used only to specify code generation options). This function is useful for converting AST nodes to strings as part of general debugging or the construction of other strings for use as input to the AST rewrite mechansims which accepts source code strings. See tutorial for examples of this. This function uses the SgUnparse_Info as an inherited attribute internally and using this attribute it will correctly handled many subtle details that will be ignored if the attribute is not provided. For example, the SgUnparse_Info can record if the statement is in a conditional and if so then the trailing ";" will be omitted in the generated code. See the SgUnparse_Info documentation for the numerous other internal settings that can effect the generated code. Because of these details, the unparseToString() function can not always be used to generate compiliable code. ‐ Return: Returns std::string
#### SgNode::unparseToCompleteString() This function unparses the AST node (including comments and white space) This function is a complement to the unparseToString() function and includes any associated comments and preprocessor control directives. Because C preprocessor control directive can be included string generated using this function may or may not be appropriate for use as input to the AST rewrite mechanism. ‐ Todo: This function needs a better name since it is unclear what the "complete" string is. ‐ Return: Returns std::string
#### SgNode::get_traversalSuccessorContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Return: Returns ordered STL Container of pointers to children nodes in AST.
#### SgNode::get_traversalSuccessorNamesContainer() FOR INTERNAL USE within ROSE traverals mechanism only. This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. ‐ Warning: This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change. Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations. ‐ Return: Returns ordered STL container of names (strings) of access names to children nodes in AST.
#### SgNode::roseRTI () FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. This function provides runtime type information for accessing the structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes. ‐ Return: Returns a RTIReturnType object (runtime type information).
FIXME: The CFG support for Fortran is still buggy ‐‐ if Fortran is re‐enabled in the test suite, there are edge mismatches indicating that the CFG's in and out edge sets are not consistent. The CFG is not recommended for use on Fortran code.
Created with MrDocs